import { GamesConfig } from "./GamesConfig";

export class GamesManager {
    private static sort(games: object) {
        let list = [];
        for (let key in games) {
            list.push(games[key]);
        }

        return list.sort((a: any, b: any) => a.sort - b.sort);
    }

    public static Games(sort: boolean) {
        return sort ? this.sort(GamesConfig.games) : GamesConfig.games;
    }

    public static AvailableGames(sort: boolean) {
        let games = GamesConfig.games;
        if (!sort) {
            return games;
        }

        return this.sort(games);
    }
}